package seed_commerce

import (
	"fmt"
	"gitee.com/theegg/go-brick/app/model/commerce/brands"
	"github.com/xormplus/xorm"
)

func InitBrandSeed(db *xorm.Engine) {
	items := make(map[int]brands.Brands)
	items[1] = brands.Brands{
		BrandName: "苹果",
		Avatar:    "/apple.png",
		Summary:   "一个很遥远的品牌",
		Status:    1,
	}

	count := 0
	errCount := 0
	for _, item := range items {
		_, err := db.Insert(item)
		if err != nil {
			fmt.Println(err.Error())
			errCount++
		} else {
			count++
		}
	}

	fmt.Printf("%5s|%25s|%10d|%8d|\n", "", "brand", count, errCount)
}
